const {
  DataTypes
} = require('sequelize');
module.exports = sequelize => {
  const attributes = {
    id: {
      type: DataTypes.BIGINT.UNSIGNED,
      allowNull: false,
      defaultValue: null,
      primaryKey: true,
      autoIncrement: true,
      comment: "自增id",
      field: "id"
    },
    title: {
      type: DataTypes.CHAR(160),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "名称",
      field: "title"
    },
    original: {
      type: DataTypes.CHAR(160),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "原始名称",
      field: "original"
    },
    path_type: {
      type: DataTypes.CHAR(80),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "路径标记",
      field: "path_type"
    },
    size: {
      type: DataTypes.BIGINT.UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "大小（单位b）",
      field: "size"
    },
    ext: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "类型（后缀名）",
      field: "ext"
    },
    type: {
      type: DataTypes.CHAR(30),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "类型（file文件, image图片, scrawl涂鸦, video视频, remote远程抓取文件）",
      field: "type"
    },
    url: {
      type: DataTypes.CHAR(255),
      allowNull: false,
      defaultValue: "",
      primaryKey: false,
      autoIncrement: false,
      comment: "url路径",
      field: "url"
    },
    hash: {
      type: DataTypes.TEXT,
      allowNull: true,
      defaultValue: null,
      primaryKey: false,
      autoIncrement: false,
      comment: "hash值",
      field: "hash"
    },
    add_time: {
      type: DataTypes.INTEGER(10).UNSIGNED,
      allowNull: false,
      defaultValue: "0",
      primaryKey: false,
      autoIncrement: false,
      comment: "添加时间",
      field: "add_time"
    }
  };
  const options = {
    tableName: "sxo_attachment",
    comment: "",
    indexes: [{
      name: "path_type",
      unique: false,
      type: "BTREE",
      fields: ["path_type"]
    }, {
      name: "type",
      unique: false,
      type: "BTREE",
      fields: ["type"]
    }]
  };
  const SxoAttachmentModel = sequelize.define("sxo_attachment_model", attributes, options);
  return SxoAttachmentModel;
};